#pragma once

class CLayer;
class CImage;

typedef std::vector< CLayer* > LayerV;

/*----------------------------------------------------------------------------*/

class CNet
{
/*----------------------------------------------------------------------------*/

public:

/*----------------------------------------------------------------------------*/

	CNet( int _inputsNum, const IntV& _neuronsNumber );

	CNet( std::ifstream& _file );
	
	~CNet();

/*----------------------------------------------------------------------------*/

	void Calculate( CImage* _image );

	void Train( double _speed, CImage* _image );	

	void CalcNewWeights( double _speed );

	void SaveToFile( std::ofstream& _file );

	double GetMeanSquareError() const;

	int GetMaxOutput() const;

	// TEMP

	void PrintStat();

	void PrintMeanSquareError( int _iteration );

	void PrintNetOutputs( int _imageNum );

/*----------------------------------------------------------------------------*/

private:

/*----------------------------------------------------------------------------*/

	int     m_inputsNum;		
	double  m_meanSquareError;
	LayerV  m_layers;
	CImage* m_currImage;

/*----------------------------------------------------------------------------*/

	void CalcLocalErrors();

	void CalcMeanSquareError();

/*----------------------------------------------------------------------------*/

	// temp
	void PrintNeuroWeights();
	void PrintNeuroOutputs();
	void PrintError();
	void PrintWeError();
	void PrintBackError();

/*----------------------------------------------------------------------------*/

};

/*----------------------------------------------------------------------------*/
